#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>

int main()
{
	int* p = (int*)malloc(20);
	if (p == NULL)
	{
		perror("malloc");
		return 1;
	}
	int* pf = (int*)realloc(p, 40);
	if (pf == NULL)
	{
		perror("realloc");
		return 2;
	}
	pf = p;
	int i = 0;
	for (i = 0; i < 10; i++)
	{
		*(pf + i) = i + 1;
		printf("%d ", *(pf + i));
	}
	free(p);
	p = NULL;
	return 0;
}